<?php
defined('IN_ADMIN') || die('Access Denied');
function index(){
	require_once template::inc('admin/login.html');
}
function login(){
	$manager = new manager();
	$userName = util::quote($_POST['userName']);
	$userPass = util::quote($_POST['userPass']);
	$row = $manager->db->where( "userName=$userName and userPass=$userPass")->find();
	//$row = $manager->db->where( "userName=$userName")->where("userPass=$userPass")->find();
	//$row = $manager->db->where( array('userName'=>$_POST['userName'],'userPass'=>$_POST['userPass']))->find();
	if ($row){
		$_SESSION['admin'] = $row;
		msg::info('?mod=index','登录成功,正在跳转!','ok');
	} else {
		msg::info('','用户名或密码错误!','err');
	}
}
function logout(){
	session_destroy();
	msg::info('?mod=login','退出成功!','ok');
}
?>